// components/hint.js
const app = getApp()
const util = require('../../utils/util.js')
Component({
        /**
         * 组件的属性列表
         */
        properties: {
                imgtype: {
                        type: Number,
                        value: ''
                },
                headerheight:{
                        type: Number,
                        value: ''
                },
                kefushow: {
                        type: Boolean,
                        value:true
                },
                butshow: {
                        type: Boolean,
                        value: true
                }
        },

        /**
         * 组件的初始数据
         */
        data: {
                list:[
                        {
                                "imgurl":"https://xq.shzxcx.com/static/image/xq/kefu.jpg",
                                "name" :"“1”"      //加客服
                        },{
                                "imgurl": "https://xq.shzxcx.com/static/image/xq/shangchuan.jpg",
                                "name": "“2”"      //上传
                        },{
                                "imgurl": "https://xq.shzxcx.com/static/image/xq/tixian.jpg",
                                "name": "“提现”"      //提现
                        },{
                                "imgurl": "https://xq.shzxcx.com/static/image/xq/jutuankefu.jpg",
                                "name": "“3”"      //剧团
                        },{
                                "imgurl": "https://img-1256481299.cos.ap-guangzhou.myqcloud.com/qqhxcx/shouchang.jpg",
                                "name": ""      //收藏视频
                        },{
                                "imgurl": "https://img-1256481299.cos.ap-guangzhou.myqcloud.com/qqhxcx/zhuomian.jpg",
                                "name": ""      //添加到桌面
                        }, {
                                "imgurl": "https://img-1256481299.cos.ap-guangzhou.myqcloud.com/qqhxcx/gongzhonghao.jpg",
                                "name": "“4”"      //添加到桌面
                        }
                ],
                toastshow: false,
                contens: "",
                jinbi: ''
        },

        /**
         * 组件的方法列表
         */
        methods: {
                cha: function (e) {
                        // 关注公众号任务
                        var token = wx.getStorageSync("tekon")
                        if (e.target.dataset.id==7){
                                var header = {
                                        'authorization': token,
                                        'content-type': "application/x-www-form-urlencoded"
                                }
                                var data = {
                                        missionId: 18
                                }
                                util.formhttp(app.globalData.appurl + "/mission", 'POST', data, header, (data) => {
                                          console.log(data)
                                        var that = this
                                        if (data.data.missionAccomplished == 1) {
                                                that.setData({
                                                        toastshow: true,
                                                        contens: "奖励添加公众号的你",
                                                        jinbi: data.data.missionReward
                                                })
                                                setTimeout(function () {
                                                        that.setData({
                                                                toastshow: false
                                                        })
                                                }, 3000)
                                        }
                                })
                        }
                        this.setData({
                                kefushow:false
                        })
                }
        }
})
